﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AzureDiagMon.Common.Mvvm
{
    public class Checkable : ViewModel, ICheckable
    {
        private string displayName;
        public string DisplayName
        {
            get { return displayName; }
            set
            {
                displayName = value;
                RaisePropertyChanged("DisplayName");
            }
        }

        private bool isChecked;
        public bool IsChecked
        {
            get { return isChecked; }
            set
            {
                isChecked = value;
                RaisePropertyChanged("IsChecked");
            }
        }

        private bool isEnabled;
        public bool IsEnabled
        {
            get { return isEnabled; }
            set
            {
                isEnabled = value;
                RaisePropertyChanged("IsEnabled");
            }
        }

        public Checkable(object value, bool isChecked = false, bool isEnabled = true)
        {
            Entity = value;
            //TODO: Convert it to extendable display name
            DisplayName = value.ToString();
            IsChecked = isChecked;
            IsEnabled = isEnabled;
        }

        protected object entity;
        public object Entity
        {
            get { return entity; }
            set { entity = value; }
        }

        public override string ToString()
        {
            return DisplayName;
        }
    }
}
